package preprocessor;

//import general.database.info.LinkInfo;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

public class ShowTables {

	public static void main(String [] args ) throws ClassNotFoundException, SQLException{
		
		
		Class.forName("org.sqlite.JDBC");
	    Connection conn = DriverManager.getConnection("jdbc:sqlite:test.db");
	    Statement stat = conn.createStatement();
		
		
		
		/*ResultSet rs = stat.executeQuery("SELECT name FROM sqlite_master WHERE type='table';");
	    while (rs.next()) {
	      System.out.println("name = " + rs.getString("name")); 
	      //System.out.println("Type = " + rs.getString("Type")); 
	     
	    }
	    
	    rs.close();
	    
	    
	    ResultSet res = stat.executeQuery("Select * from nodes where nkey = 10");
	    
	    while (res.next()) {
		      System.out.println("name = " + rs.getString("name"));
		      System.out.println("key = " + rs.getString("nkey"));    
		    }
	    
	    
	    res.close();
	    
	    ResultSet linkRes = stat.executeQuery("select * from links");
	    while (res.next()) {
	    	
		      System.out.println("Node1 = " + rs.getString("Node1"));
		      System.out.println("Node2 = " + rs.getString("Node2"));
		      
		}
	    linkRes.close();*/
	    
	    ResultSet results2 = stat.executeQuery("Select * from links where Node1 = 1704");// where Node1 = " + 500);
		while (results2.next()){

			//linkInfo.add( new LinkInfo(results2.getInt("nkey"), results2.getInt(TALBE_LINK_NAME2), nodeKey));
			
			System.out.println("link key " + results2.getInt("nkey") + ", " + results2.getInt("Node1") + ", " + results2.getInt("Node2"));
			/*System.out.println("link key " + results2.getInt("Node2"));
			System.out.println("link key " + results2.getInt("nkey"));*/
			
			
		}
	    
	    
	    conn.close();
		
		
	}
	
	
}

